<template>
  <div class="device-detail-container">
    <el-card>
      <template #header>
        <div class="card-header">
          <span>设备详情</span>
          <el-button @click="goBack">返回</el-button>
        </div>
      </template>
      
      <el-descriptions :column="1" border>
        <el-descriptions-item label="设备ID">1</el-descriptions-item>
        <el-descriptions-item label="设备名称">摄像头001</el-descriptions-item>
        <el-descriptions-item label="设备类型">摄像头</el-descriptions-item>
        <el-descriptions-item label="状态">
          <el-tag type="success">在线</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="IP地址">192.168.1.101</el-descriptions-item>
        <el-descriptions-item label="位置">大厅</el-descriptions-item>
        <el-descriptions-item label="创建时间">2023-01-15 09:30:00</el-descriptions-item>
        <el-descriptions-item label="最后在线时间">2023-04-20 15:45:30</el-descriptions-item>
        <el-descriptions-item label="备注">大厅入口处监控摄像头</el-descriptions-item>
      </el-descriptions>
      
      <div class="device-info-section">
        <h3>设备信息</h3>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-card class="info-card">
              <div class="info-item">
                <div class="info-label">CPU使用率</div>
                <div class="info-value">45%</div>
              </div>
            </el-card>
          </el-col>
          <el-col :span="12">
            <el-card class="info-card">
              <div class="info-item">
                <div class="info-label">内存使用率</div>
                <div class="info-value">62%</div>
              </div>
            </el-card>
          </el-col>
        </el-row>
      </div>
    </el-card>
  </div>
</template>

<script>
import { useRouter } from 'vue-router'

export default {
  name: 'DeviceDetail',
  setup() {
    const router = useRouter()
    
    const goBack = () => {
      router.go(-1)
    }
    
    return {
      goBack
    }
  }
}
</script>

<style scoped>
.device-detail-container {
  padding: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.device-info-section {
  margin-top: 30px;
}

.device-info-section h3 {
  margin-bottom: 15px;
}

.info-card {
  margin-bottom: 20px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.info-label {
  font-weight: bold;
}

.info-value {
  font-size: 18px;
  color: #409eff;
}
</style>